package 设计模式.行为模式._23访问者模式;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
        Visitor visitor = new ConcreteVisitor(); //创建一个访问者
        StringElement se = new StringElement("abc"); // String对象
        se.accept(visitor); //String 让访问者获取内部信息
        
        FloatElement fe = new FloatElement(new Float(1.5)); //Float对象
        fe.accept(visitor); //float
        System.out.println("===========");
        List result = new ArrayList();
        result.add(new StringElement("abc"));
        result.add(new StringElement("abc"));
        result.add(new StringElement("abc"));
        result.add(new FloatElement(new Float(1.5)));
        result.add(new FloatElement(new Float(1.5)));
        result.add(new FloatElement(new Float(1.5)));
        visitor.visitCollection(result);
    }
}